<?php
function leaguescoreboard(){
	global $_SGET,$_SPOST,$_SREQUEST;
	$id=$_SGET['id'];
	if ($_SERVER['REQUEST_METHOD']=="GET"){
		$rows=array();
		$query2="SELECT * FROM teams WHERE id in(SELECT teamid FROM leagueplayers WHERE leagueid='$id') ORDER BY `points` DESC";
		$result2=mysql_query($query2);
		while($r = mysql_fetch_assoc($result2)){
			$rows[]=$r;
		}
		print json_encode($rows);
	}
}
?>